package com.ymatou.query.seller.trading.api.parameter;

import java.lang.reflect.Field;
import java.math.BigDecimal;

import net.sf.json.JSONObject;

import com.ymttest.utils.DataUtil;
import com.ymttest.utils.YMTDateUtil;
import com.ymttest.utils.constant.DateConstant;

public class FlowsDetail extends Flows {
	/**
	 * 账户余额支付金额
	 */
	private BigDecimal AccountPaidAmount = new BigDecimal(0);
	/**
	 * 优惠券渠道：卖家优惠券、平台优惠券
	 */
	private Integer CouponChannel;
	/**
	 * 平台优惠券码
	 */
	private String CouponCode;
	/**
	 * 凭证，如：退货退款单号、交易号
	 */
	private String Evidence;
	/**
	 * 免运卡
	 */
	private BigDecimal FreeCard = new BigDecimal(0);
	/**
	 * true:收入 false:支出
	 */
	private boolean IsIncoming;
	/**
	 * 操作类型
	 */
	private Integer Operation;
	/**
	 * 调价
	 */
	private BigDecimal PriceChange = new BigDecimal(0);
	/**
	 * 卖家优惠券码
	 */
	private String SellerCouponCode;
	/**
	 * 第三方名称. alipay:支付宝 wechat:微信
	 */
	private String ThirdPartyName;
	/**
	 * 第三方支付金额
	 */
	private BigDecimal ThirdPartyPaidAmount;
	/**
	 * 发生时间
	 */
	private String Time = DateConstant.defaultDateString;

	public BigDecimal getAccountPaidAmount() {
		return AccountPaidAmount;
	}

	public void setAccountPaidAmount(BigDecimal accountPaidAmount) {
		AccountPaidAmount = accountPaidAmount;
	}

	public Integer getCouponChannel() {
		return CouponChannel;
	}

	public void setCouponChannel(Integer couponChannel) {
		CouponChannel = couponChannel;
	}

	public String getCouponCode() {
		return DataUtil.Stringg.getValueOrDefault(CouponCode);
	}

	public void setCouponCode(String couponCode) {
		CouponCode = couponCode;
	}

	public String getEvidence() {
		return DataUtil.Stringg.getValueOrDefault(Evidence);
	}

	public void setEvidence(String evidence) {
		Evidence = evidence;
	}

	public BigDecimal getFreeCard() {
		return FreeCard;
	}

	public void setFreeCard(BigDecimal freeCard) {
		FreeCard = freeCard;
	}

	public boolean isIsIncoming() {
		return IsIncoming;
	}

	public void setIsIncoming(boolean isIncoming) {
		IsIncoming = isIncoming;
	}

	public Integer getOperation() {
		return Operation;
	}

	public void setOperation(Integer operation) {
		Operation = operation;
	}

	public BigDecimal getPriceChange() {
		return PriceChange;
	}

	public void setPriceChange(BigDecimal priceChange) {
		PriceChange = priceChange;
	}

	public String getSellerCouponCode() {
		return DataUtil.Stringg.getValueOrDefault(SellerCouponCode);
	}

	public void setSellerCouponCode(String sellerCouponCode) {
		SellerCouponCode = sellerCouponCode;
	}

	public String getThirdPartyName() {
		return ThirdPartyName;
	}

	public void setThirdPartyName(String thirdPartyName) {
		ThirdPartyName = thirdPartyName;
	}

	public BigDecimal getThirdPartyPaidAmount() {
		return ThirdPartyPaidAmount;
	}

	public void setThirdPartyPaidAmount(BigDecimal thirdPartyPaidAmount) {
		ThirdPartyPaidAmount = thirdPartyPaidAmount;
	}

	public String getTime() {
		if(Time != null){
			return  YMTDateUtil.getBeforeOrNextDay(Time.replaceAll(" ", "T"), 0, YMTDateUtil.YMDTHMS_STRING);
		}
		return Time;
	}

	public void setTime(String time) {
		if(time != null){
			Time = YMTDateUtil.getBeforeOrNextDay(time.replaceAll(" ", "T"), 0, YMTDateUtil.YMDTHMS_STRING);
		}
		Time = time;
	}
	
	public boolean equals(FlowsDetail that){
		return this.toString().equals(that.toString());
	}
	
	public String toString(){
		JSONObject object = JSONObject.fromObject(this);
		object.remove("time");
		return DataUtil.Json.sortJsonObject(object.toString()).toString();
	}

	public static void main(String[] args) {
		Class c = FlowsDetail.class;
		for (Field f : c.getDeclaredFields()) {
			String s = f.getName();
			System.out.println("DataUtil.verifyDecimalEquals(expect.get"
					+ s + "(), actual.get" + s
					+ "(),\"验证Flows[\" + i + \"]." + s
					+ "\");");
		}
	}
	
}
